<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>无标题文档</title>
        <script language="javascript" type="text/javascript" src="{lib file=jquery.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
        <script language="JavaScript" type="text/javascript" src="{res file=js/lan.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
		<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.tip.js}"></script>
        <link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
        <style>
            label.error {color:red;}
        </style>
		<script language="javascript" type="text/javascript">
		</script>
    </head>
    <body>
        <div class="sub-body" style="width:1500px;">
             <a href="javascript:;" onclick="$('#head').slideToggle();">收起/展开</a>
             <div id="head" style="width:1000px;">
            <h3 class="title-1">订单状态查询</h3>
            <div class="tab-frame-s">
                <form action="index.php" method="get">
                    <table cellspacing="0" cellpadding="0" class="tab-frame" >
                    <tr>
                        <td width="10%" align="right">订 单 号：</td>
                        <td width="16%"><input type="text" id="order_sn" name="order_sn" class="input-1" /></td>
                        <td width="10%" align="right">款&nbsp;&nbsp;&nbsp;&nbsp;号：</td>
                        <td width="15%"><input type="text" id="style_sn" name="style_sn" class="input-1" /></td>
                        <td width="12%" align="right">订单状态：</td>
                        <td width="15%"><select name="status" id="status">
                                        <option value="-1">全部</option>
                                    <!--{foreach from=$lang.order_status item=os key=k}-->
                                        <option value="{$k}">{$os}</option>
                                        <!--{/foreach}-->
                                    </select></td>
                        <td width="22%" rowspan="3">
                            <input type="hidden" value="status_search" name="act"/>
                            <input type="hidden" value="order" name="app" />
                            <input  name="search" type="submit" class="btn-2" value="查询"/></td>
                    </tr>
                    <tr>
                        <td width="10%" align="right">品&nbsp;&nbsp;&nbsp;&nbsp;牌：</td>
                        <td width="16%">
                            <select name="brand_id" id="brand_id" onChange="brand_change(this.value);">
                                <option value="0">{$lang.select_pls}</option>
                                <!--{foreach from=$brand_list item=brand key=k}-->
                                <option value="{$brand.brand_id}">{$brand.brand_name}</option>
                                <!--{/foreach}-->
                            </select>
                        </td>
                        <td width="10%" align="right">买&nbsp;&nbsp;&nbsp;&nbsp;手：</td>
                        <td width="15%"><select name="buyer_id" id="buyer_id" <!--{if $role !=USER_MERCHANDISER}-->onnChange="buyer_change(this.value);"<!--{/if}-->>
                                <option value="0">{$lang.select_pls}</option>
                                <!--{foreach from=$buyer_list item=buyer}-->
                                <option value="{$buyer.user_id}">{$buyer.user_name}</option>
                                <!--{/foreach}-->
                            </select></td>
                        <td width="12%" align="right">跟&nbsp;&nbsp;&nbsp;&nbsp;单：</td>
                        <td width="15%"><select name="merchandiser_id" id="merchandiser_id">
                                <option value="0">{$lang.select_pls}</option>
                                <!--{foreach from=$merchandiser_list item=merchandiser}-->
                                <option value="{$merchandiser.user_id}">{$merchandiser.user_name}</option>
                                <!--{/foreach}-->
                            </select></td>
                    </tr>
                    <tr>
                        <td width="10%" align="right">工&nbsp;&nbsp;&nbsp;&nbsp;厂：</td>
                        <td><select name="factory_id" id="factory_id">
                                <option value="0">{$lang.select_pls}</option>
                                <!--{foreach from=$factory_list item=factory}-->
                                <option value="{$factory.factory_id}">{$factory.factory_name}</option>
                                <!--{/foreach}-->
                            </select></td><td colspan="4">&nbsp;</td>
                    </tr>
                </table>
                </form>
            </div>
            <script>
                    <!--{if $role==USER_MERCHANDISER}-->
                       //$('#brand_id').attr('disabled','disabled');
                       $('#merchandiser_id option:first-child').remove();
                       $('#merchandiser_id').val('{$user.user_id}');
                       $('#merchandiser_id').attr('readonly','readonly');
                    <!--{/if}-->
                </script>
            </div>
            <br /><br />
            <div class="tab-frame">
                <div class="tab-title-1"><span>订单状态查询列表</span></div>
                <table width="100%" cellspacing="0" cellpadding="0" id="tab-color2" class="tab-add">
                    <tbody><tr>
                            <th width="35">序号</th>
                            <th width="70">下单日期</th>
                            <th width="50">订单号</th>
                            <th width="50">款号</th>
                            <th width="40">品牌</th>
                            <th width="50">买手</th>
                            <th width="60">跟单</th>
							<th width="30">剩余天数</th>
                            <th width="80">工厂</th>
                            <th width="70">图片</th>
							<th width="450">详细信息</th>
							<th width="70">工厂附件</th>
							<th width="70">批改意见</th>
							<th width="70">合同信息</th>
							<th width="70">制单信息</th>
							<th width="70">查货报告</th>
                            <th>操作</th>
                        </tr>
                         <!--{foreach from=$orders item=order name=o}-->
                        <tr>
                            <td>{$smarty.foreach.o.iteration}</td>
                            <td>{$order.order_create_date|date}</td>
                            <td><a href="{url app=order&act=edit&id=$order.order_id}" title="点击查看订单信息">{$order.order_sn}</a></td>
                            <td>{$order.style_sn}</td>
                            <td>{$order.brand_name}</td>
                            <td>{$order.buyer_name}</td>
							<td>{$order.merchandiser|escape}</td>
							<td>{$order.left_days}</td>
							<td>{$order.factory_name|escape}</td>
                            <td><a href="{$site_url}/{$order.front_pic}" target="_blank"><img src="{$order.front_pic}" width="60" alt="图片"/></a></td>
							<td align="left" class="info" edit_id="{$order.order_id}">
								<table border="0" cellpadding="3" cellspacing="0" width="100%">
									<tr><td width="110">1)&nbsp;参考板：</td>
										<td><p class="more" field="ref_sample">{$order.ref_sample|escape}</p><textarea name="ref_sample" class="edit"></textarea></td></tr>
									<tr><td>2)&nbsp;生产板/价格：</td>
										<td><p class="more" field="made_price">{$order.made_price|escape}</p><textarea name="made_price" class="edit"></textarea></td></tr>
									<tr>
										<td>3)&nbsp;色卡/色号：</td>
										<td><p class="more" field="color_card">{$order.color_card|escape}</p><textarea name="color_card" class="edit"></textarea></td>
									</tr>
									<tr>
										<td>4)&nbsp;大货布：</td>
										<td><p class="more" field="bulk">{$order.bulk|escape}</p><textarea name="bulk" class="edit"></textarea></td>
									</tr>
									<tr>
										<td>5)&nbsp;货前板：</td>
										<td><p class="more" field="before_sample">{$order.before_sample|escape}</p><textarea name="before_sample" class="edit"></textarea></td>
									</tr>
									<tr>
										<td>6)&nbsp;备注：</td>
										<td><p class="more" field="description">{$order.description|escape}</p><textarea name="description" class="edit"></textarea></td>
									</tr>
								</table>
							</td>
							<td>
								<p style="width:70px; margin-bottom:3px; text-align:left;">
								<div style="width:70px;word-wrap:break-word;*word-break:break-all; text-align:left;">
									<!--{foreach from=$order.file_factory item=file name=f}-->
									<a href="download.php?id={$file.file_id}">{$file.file_name}</a></div><a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$file.file_id}" class="pic_del">&nbsp;</a><!--{if !$smarty.foreach.f.last}--><br /><!--{/if}-->
									<!--{/foreach}-->
								</p>
							</td>
							<td>
								<p id="file_pigai" style="width:100%; margin-bottom:3px; text-align:left;">
								<div style="width:70px;word-wrap:break-word;*word-break:break-all; text-align:left;">
								<!--{foreach from=$order.file_pigai item=file name=f}-->
								<a href="download.php?id={$file.file_id}">{$file.file_name}</a></div><a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$file.file_id}" class="pic_del">&nbsp;</a><!--{if !$smarty.foreach.f.last}--><br /><!--{/if}-->
								<!--{/foreach}-->
								</p>
								<input type="button" onclick="upload_docs({$atttype.pigai}, {$order.order_id});" value="上传附件" class="btn-3">
							</td>
							<td>
								<p id="file_hetong" style="width:70px; margin-bottom:3px; text-align:left;">
								<div style="width:70px;word-wrap:break-word;*word-break:break-all; text-align:left;">
								<!--{foreach from=$order.file_hetong item=file name=f}-->
								<a href="download.php?id={$file.file_id}">{$file.file_name}</a></div><a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$file.file_id}" class="pic_del">&nbsp;</a><!--{if !$smarty.foreach.f.last}--><br /><!--{/if}-->
								<!--{/foreach}-->
								</p>
								<input type="button" onclick="upload_docs({$atttype.hetong}, {$order.order_id});" value="上传附件" class="btn-3">
							</td>
							<td align="left">
								<p id="file_zhidan" style="width:100%; margin-bottom:3px;">
								<!--{foreach from=$order.file_zhidan item=file name=f}-->
								<div style="width:70px;word-wrap:break-word;*word-break:break-all; text-align:left;">
								<a href="download.php?id={$file.file_id}">{$file.file_name}</a><br /></div><a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$file.file_id}" class="pic_del">&nbsp;</a><!--{if !$smarty.foreach.f.last}--><br /><!--{/if}-->
								<!--{/foreach}--><br />
								</p>
								<input type="button" onclick="upload_docs({$atttype.zhidan}, {$order.order_id});" value="上传附件" class="btn-3">
							</td>
							<td>
								<p id="file_chahuo" style="width:100%; margin-bottom:3px; text-align:left;">
								<!--{foreach from=$order.file_chahuo item=file name=f}-->
								<div style="width:70px;word-wrap:break-word;*word-break:break-all; text-align:left;">
								<a href="download.php?id={$file.file_id}">{$file.file_name}</a></div><a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$file.file_id}" class="pic_del">&nbsp;</a><!--{if !$smarty.foreach.f.last}--><br /><!--{/if}-->
								<!--{/foreach}-->
								</p>
								<input type="button" onclick="upload_docs({$atttype.chahuo}, {$order.order_id});" value="上传附件" class="btn-3">
							</td>
                            <td order_id="{$order.order_id}">
                                <input type="button" handle="edit" value="编辑" class="btn-s-5" style="width:43px;" />
                                <input type="button" handle="update" value="更新" class="btn-s-5" style="width:43px;display:none;" />
								<input type="button" handle="cancel" value="取消" class="pic_del" style="margin:0 0 0 2px; display:none; cursor:pointer;" />
                            </td>
                        </tr>
                         <!--{/foreach}-->
                    </tbody></table>
<style type="text/css">
<!--
.info p {max-width:340px;cursor:pointer; line-height:15px;}
textarea.edit {width:280px; height:50px; float:right; display:none;}
-->
</style>
<script language="JavaScript" type="text/javascript">
$(function(){
	<!--{if $search}-->
	var get_para={$get_para};
	$.each(get_para,function(k,v){
		if($('#'+k)){
			$('#'+k).attr('value', v);
		}
	});
	<!--{/if}-->
	/*$('.info p').each(function () {
		$(this).jsimtip({text : $(this).html(), width : 350});
	});*/
	$('input[handle="edit"]').click(function(){
		var order_id = $(this).parent().attr('order_id');
		$('td[edit_id="' + order_id + '"] p').hide();
		$('td[edit_id="' + order_id + '"] textarea').show();
		$('td[edit_id="' + order_id + '"] textarea').each(function() {
			$(this).val($(this).prev().html());
		});
		$(this).hide();
		$(this).parent().contents('input[handle="update"]').show();
		$(this).parent().contents('input[handle="cancel"]').show();
	});
	$('input[handle="update"]').click(function(){
		var order_id = $(this).parent().attr('order_id');
		var post_url = 'index.php?app=order&act=edit_order_status';
		var btn_update = $(this);
		$('td[edit_id="' + order_id + '"] textarea').attr('disabled', true);
		var post_data = {
			order_id : order_id,
			ref_sample : $('td[edit_id="' + order_id + '"] textarea[name="ref_sample"]').val(),
			made_price : $('td[edit_id="' + order_id + '"] textarea[name="made_price"]').val(),
			color_card : $('td[edit_id="' + order_id + '"] textarea[name="color_card"]').val(),
			bulk : $('td[edit_id="' + order_id + '"] textarea[name="bulk"]').val(),
			before_sample : $('td[edit_id="' + order_id + '"] textarea[name="before_sample"]').val(),
			description : $('td[edit_id="' + order_id + '"] textarea[name="description"]').val()
		};
		$.post(post_url, post_data, function(data){
			if (data.result == 'true') {
				$('td[edit_id="' + order_id + '"] p').each(function() {
					$(this).html($(this).next().val());
					//$(this).jsimtip({text : $(this).html(), width : 350});
				});
			}
			$('td[edit_id="' + order_id + '"] textarea').attr('disabled', false);
			btn_update.parent().contents('input[handle="cancel"]').click()
			alert(data.msg);
			}, 'json');
	});
	$('input[handle="cancel"]').click(function(){
		var order_id = $(this).parent().attr('order_id');
		$('td[edit_id="' + order_id + '"] p').show();
		$('td[edit_id="' + order_id + '"] textarea').hide();
		$('td[edit_id="' + order_id + '"] textarea').each(function(){
			$(this).val('');
		});
		$(this).hide();
		$(this).parent().contents('input[handle="edit"]').show();
		$(this).parent().contents('input[handle="update"]').hide();
	});
});
</script>
            </div>
            <div class="page">
                {include file=page.html}
            </div>
        </div>
<script language="JavaScript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
    </body>
</html>
